﻿using System;
using System.Collections.Generic;
using System.Web;
using eShop.Model;
using eShop.DataAccess;

public partial class display_reviews : SitePublicBasePage
{
    public Int32 _ProductId
    {
        get
        {
            try
            {
                if (HttpContext.Current.Request.QueryString != null && !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["productId"]))
                {
                    return Convert.ToInt32(HttpContext.Current.Request.QueryString["productId"]);
                }
                else
                {
                    return -1;
                }
            }
            catch
            {
                return -1;
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (_ProductId!=-1)
            {
                LoadProductReviews();
            }
        }
    }
    private void LoadProductReviews()
    {
        try
        {
           
            IList<ProductReview> reviews =ProductReviewDAO.GetTblProductReviewByProductId(_ProductId);

            rptProductReviews.DataSource = reviews;
            rptProductReviews.DataBind();
           
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }

    
}